package fjut.acm.coding.component.judge.data;

public enum LanguageType {

    GPP(0,"G++"),
    GCC(1,"GCC"),
    JAVA(2,"JAVA"),
    PASCAL(3,"Pascal"),
    CPP(4,"C++"),
    C(5,"C"),
    PYTHON3(6,"Python3");

    private int code;
    private String name;

    LanguageType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static int getCodeByName(String name){
        for(LanguageType item : LanguageType.values()){
            if(item.name.equals(name)){
                return item.code;
            }
        }
        return -1;
    }

    public static String getNameBtCode(int code){
        for(LanguageType item : LanguageType.values()){
            if(item.getCode() == code){
                return item.getName();
            }
        }
        return null;
    }
}
